﻿using System.ComponentModel;
using Microsoft.SemanticKernel;

namespace CodeAgent.Function;

public class UserFunction
{
    /// <summary>
    /// 找用户确认需求
    /// </summary>
    /// <returns></returns>
    [KernelFunction, Description("找用户确认需求，并且等待用户提供确认")]
    public string ConfirmRequirement(
        [Description("需要确认的需求")] string requirement
    )
    {
        Console.WriteLine(requirement);

        Console.WriteLine("请确认需求，输入yes/no");

        var result = Console.ReadLine();

        return result;
    }

    /// <summary>
    /// 确认用户是否有额外的需要
    /// </summary>
    /// <returns></returns>
    [KernelFunction, Description("确认用户是否有额外的需要")]
    public string ConfirmAdditionalRequirement(
        [Description("提醒用户是否有额外的需求")] string reminder
    )
    {
        Console.WriteLine(reminder);

        Console.WriteLine("请输入您的额外需求，如果没有额外需求，请输入no");

        var result = Console.ReadLine();

        return result;
    }

    /// <summary>
    /// 当任务完成时，通知用户，让用户确认是否满足需求，如果满足则返回[done]
    /// </summary>
    /// <returns></returns>
    [KernelFunction, Description("当任务完成时，通知用户，让用户确认是否满足需求，如果满足则返回[done]")]
    public string NotifyUserTaskDone(
        [Description("任务完成的消息")] string message
    )
    {
        Console.WriteLine(message);

        Console.WriteLine("请确认是否满足需求，输入yes/no");

        var result = Console.ReadLine();

        return result;
    }
}